package servlet;

import service.LogicService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

/**
 *2022.3.16测试完成，由吴俊莹编写
 * 查看
 */

@WebServlet(name = "/CheckServlet",value = "/CheckServlet")
public class CheckServlet extends HttpServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{
        req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=UTF-8");

        LogicService logic=new LogicService();
        int keshu=0;
        try {
            keshu=logic.CheckUser(logic.teacherID("li"));
        } catch (SQLException e) {
            e.printStackTrace();
        }

        PrintWriter out=resp.getWriter();
        out.print(keshu);
    }
}
